<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="embroot.css">
<TITLE>
Referring to ECLiPSe terms from C++
</TITLE>
</HEAD>
<BODY >
<A HREF="embroot067.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="embroot065.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="embroot069.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc133">B.3</A>&nbsp;&nbsp;Referring to ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> terms from C++</H2>
The data types EC_refs and EC_ref provide a means to have non-volatile
references to ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> data from within C++ data structures. However,
it must be kept in mind that ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> data structures are nevertheless
subject to backtracking, which means they may be reset to an earlier
status when the search engine requires it. Creating a reference to
a data structure does not change that in any way. In particular, 
when the search engine fails beyond the state where the reference was
set up, the reference disappears and is also reset to its earlier value.
<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description">
<B>EC_refs(int n)</B><DD CLASS="dd-description"><BR>
	create a data structure capable of holding n non-volatile
	references to ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> data items. They are each initialised
	with a freshly created ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> variable.<BR>
<BR>
<DT CLASS="dt-description"><B>EC_refs(int n,EC_word pw)</B><DD CLASS="dd-description"><BR>
	create a data structure capable of holding n non-volatile
	references to ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> data items. They are all initialised
	with the value pw, which must be of a simple type.<BR>
<BR>
<DT CLASS="dt-description"><B>&sim;EC_refs()</B><DD CLASS="dd-description"><BR>
	destroy the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> references. It is important that this
	is done, otherwise the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> garbage collector will not
	be able to free the references data structures, which may
	eventually lead to memory overflow.<BR>
<BR>
<DT CLASS="dt-description"><B>EC_word EC_refs::operator[&nbsp;](int i)</B><DD CLASS="dd-description"><BR>
	return the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> term referred to by the i'th reference.<BR>
<BR>
<DT CLASS="dt-description"><B>void EC_refs::set(int i, EC_word new)</B><DD CLASS="dd-description"><BR>
	assign the term new to the i'th reference.
	This is a backtrackable operation very similar to
	<A HREF="../bips/kernel/termmanip/setarg-3.html"><B>setarg/3</B></A><A NAME="@default387"></A>.<BR>
<BR>
<DT CLASS="dt-description"><B>EC_word list(EC_refs&amp;)</B><DD CLASS="dd-description"><BR>
	creates an ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> list containing all the elements of the EC_refs.<BR>
<BR>
<DT CLASS="dt-description"><B>EC_ref()</B><DD CLASS="dd-description"><BR>
<DT CLASS="dt-description"><B>EC_ref(EC_word pw)</B><DD CLASS="dd-description"><BR>
<DT CLASS="dt-description"><B>&sim;EC_ref()</B><DD CLASS="dd-description"><BR>
	analogous to the corresponding EC_refs constructors/destructor.<BR>
<BR>
<DT CLASS="dt-description"><B>EC_ref&amp; operator=(const EC_word)</B><DD CLASS="dd-description"><BR>
	assign a value to the EC_ref.<BR>
<BR>
<DT CLASS="dt-description"><B>EC_word(const EC_ref&amp;)</B><DD CLASS="dd-description"><BR>
	retrieves the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> term referenced by the EC_ref.
</DL>
<HR>
<A HREF="embroot067.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="embroot065.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="embroot069.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
